package com.qlzb.taskmanagement.service.base.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.qlzb.taskmanagement.service.base.BaseService;
import com.qlzb.taskmanagement.pojo.OutputWrapper;
import com.qlzb.taskmanagement.vo.base.*;

/**
 * Created with IntelliJ IDEA.
 *
 * @ClassName BaseServiceImpl
 * @Description RECORD, EXAMPLE  BaseMapper 中使用的泛型
 * RECORD      例：SystemPermission
 * EXAMPLE     例：SystemPermissionExample
 * @Authr 袁聪
 * @Date 2018/10/2 23:30
 * @Version v2.0
 */
public abstract class BaseServiceImpl<QueryVo extends BaseQueryVo, FormVo extends BaseFormVo, IdVo extends BaseIdVo, IdListVo extends BaseIdListVo, ActionVo extends BaseActionVo, VerifyVo extends BaseVerifyVo> implements BaseService<QueryVo, FormVo, IdVo, IdListVo, ActionVo, VerifyVo> {

    /**
     * 日志
     */
    protected final Logger logger = LoggerFactory.getLogger(this.getClass());

    /**
     * 为sql屏接上限制查询条件组织机构
     * @param sql           sql
     * @param authOfficeId  组织机构id
     * @return
     */
    protected String AssemblySQLAuthOfficeId(String sql, String authOfficeId){

        // sql 拼接



        return sql;
    }

    /**
     * Mapper
     */

    @Override
    public OutputWrapper findById(IdVo vo) {

        String hint = "请重写方法！位置：" + this.getClass().getName() + " -- " + new RuntimeException().getStackTrace()[0].getMethodName() + "";
        return OutputWrapper.markCustom(false, "500", hint, hint);
    }

    @Override
    public OutputWrapper findByIdList(IdListVo vo) {
        String hint = "请重写方法！位置：" + this.getClass().getName() + " -- " + new RuntimeException().getStackTrace()[0].getMethodName() + "";
        return OutputWrapper.markCustom(false, "500", hint, hint);
    }

    @Override
    public OutputWrapper findOne(QueryVo vo) {
        String hint = "请重写方法！位置：" + this.getClass().getName() + " -- " + new RuntimeException().getStackTrace()[0].getMethodName() + "";
        return OutputWrapper.markCustom(false, "500", hint, hint);
    }

    @Override
    public OutputWrapper findOneByQueryVo(QueryVo vo) {
        String hint = "请重写方法！位置：" + this.getClass().getName() + " -- " + new RuntimeException().getStackTrace()[0].getMethodName() + "";
        return OutputWrapper.markCustom(false, "500", hint, hint);
    }

    @Override
    public OutputWrapper findAll() {
        String hint = "请重写方法！位置：" + this.getClass().getName() + " -- " + new RuntimeException().getStackTrace()[0].getMethodName() + "";
        return OutputWrapper.markCustom(false, "500", hint, hint);
    }

    @Override
    public OutputWrapper findAllByQueryVo(QueryVo vo) {
        String hint = "请重写方法！位置：" + this.getClass().getName() + " -- " + new RuntimeException().getStackTrace()[0].getMethodName() + "";
        return OutputWrapper.markCustom(false, "500", hint, hint);
    }

    @Override
    public OutputWrapper findAllAndPageByQueryVo(QueryVo vo) {
        String hint = "请重写方法！位置：" + this.getClass().getName() + " -- " + new RuntimeException().getStackTrace()[0].getMethodName() + "";
        return OutputWrapper.markCustom(false, "500", hint, hint);
    }

    @Override
    public OutputWrapper verify(VerifyVo vo) {
        String hint = "请重写方法！位置：" + this.getClass().getName() + " -- " + new RuntimeException().getStackTrace()[0].getMethodName() + "";
        return OutputWrapper.markCustom(false, "500", hint, hint);
    }

    @Override
    public OutputWrapper add(FormVo vo) {

        String hint = "请重写方法！位置：" + this.getClass().getName() + " -- " + new RuntimeException().getStackTrace()[0].getMethodName() + "";
        return OutputWrapper.markCustom(false, "500", hint, hint);
    }

    @Override
    public OutputWrapper modify(FormVo vo) {
        String hint = "请重写方法！位置：" + this.getClass().getName() + " -- " + new RuntimeException().getStackTrace()[0].getMethodName() + "";
        return OutputWrapper.markCustom(false, "500", hint, hint);
    }

    @Override
    public OutputWrapper modify(IdVo vo) {
        String hint = "请重写方法！位置：" + this.getClass().getName() + " -- " + new RuntimeException().getStackTrace()[0].getMethodName() + "";
        return OutputWrapper.markCustom(false, "500", hint, hint);
    }

    @Override
    public OutputWrapper modify(ActionVo vo) {
        String hint = "请重写方法！位置：" + this.getClass().getName() + " -- " + new RuntimeException().getStackTrace()[0].getMethodName() + "";
        return OutputWrapper.markCustom(false, "500", hint, hint);
    }

    @Override
    public OutputWrapper removeById(IdVo vo) {
        String hint = "请重写方法！位置：" + this.getClass().getName() + " -- " + new RuntimeException().getStackTrace()[0].getMethodName() + "";
        return OutputWrapper.markCustom(false, "500", hint, hint);
    }

    @Override
    public OutputWrapper removeByIdList(IdListVo vo) {
        String hint = "请重写方法！位置：" + this.getClass().getName() + " -- " + new RuntimeException().getStackTrace()[0].getMethodName() + "";
        return OutputWrapper.markCustom(false, "500", hint, hint);
    }
}
